package health.lm.com.mine.activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.jakewharton.rxbinding2.view.RxView;
import com.lm.sjy.titlebar.widget.CommonTitleBar;

import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import health.lm.com.component_base.base.mvp.activity.XActivity;
import health.lm.com.mine.R;
import health.lm.com.mine.R2;
import health.lm.com.mine.entity.AllianceBusinessBean;
import health.lm.com.mine.present.FeedbackPresenter;
import health.lm.com.router.ARouterConstant;

/**
 * 意见反馈
 *
 * @author Administrator
 */
@Route(path = ARouterConstant.FeedbackActivity)
public class FeedbackActivity extends XActivity<FeedbackPresenter> {

    @BindView(R2.id.title_bar)
    CommonTitleBar titlebar;
    @BindView(R2.id.et_content)
    EditText etContent;
    @BindView(R2.id.tv_submit)
    TextView tvSubmit;

    @Override
    public int getLayoutId() {
        return R.layout.activity_feedback;
    }

    @Override
    public FeedbackPresenter newP() {
        return new FeedbackPresenter();
    }

    @SuppressLint("CheckResult")
    @Override
    public void initData(Bundle savedInstanceState) {
        //返回按钮
        titlebar.setListener((v, action, extra) -> finish());
        //提交
        RxView.clicks(tvSubmit)
                .throttleFirst(2, TimeUnit.SECONDS)
                .compose(bindToLife())
                .subscribe(o -> getP().submit(etContent.getText().toString()));
    }


    public void setData() {
        getvDelegate().toastShort("提交成功");
        finish();
    }

}
